using UnityEngine;
using System.IO;
using System.Collections;
using System.Xml;

public class InitializeConfig : MonoBehaviour
{

	
	void Awake ()
	{
		
		if(!PlayerPrefs.HasKey("CurrentScene"))
		{
			PlayerPrefs.SetInt("CurrentScene",1);
		}
		
		if(!PlayerPrefs.HasKey("Tutorial"))
		{
			PlayerPrefs.SetString("Tutorial","On");
		}
		
		if(!PlayerPrefs.HasKey("Audio"))
		{
			PlayerPrefs.SetString("Audio","On");
		}
		
		if(PlayerPrefs.GetString("Audio").Equals("On"))
		{
			AudioListener.volume = 1;
		}
		else
		{
			AudioListener.volume = 0;
		}
		
		//Check if Language
		if (!string.IsNullOrEmpty(PlayerPrefs.GetString ("Language")))
		{
			if(PlayerPrefs.GetInt("HasChangeLanguage") == 0)
			{
				SetLanguage();
			}
		}
		else
		{
			SetLanguage();
		}

	}
	
	void SetLanguage()
	{
	
		if (Application.systemLanguage.Equals(SystemLanguage.Portuguese))
		{
			PlayerPrefs.SetString ("Language", "Portugues");
		}
		else
		{
			PlayerPrefs.SetString ("Language", "English");
		}		
	}
	
}
